robomindfandomcom-20200214-history
Scripting Language
in a image.]] A script language is a programming language that supports scripts: programs written for a special run-time environment that automate the execution of tasks that could alternatively be executed one-by-one by a human operator. Scripting languages are often interpreted (rather than compiled). Primitives are usually the elementary tasks or API calls, and the language allows them to be combined into more complex programs. Environments that can be automated through scripting include software applications, web pages within a web browser, the shells of operating systems (OS), embedded systems, as well as numerous games. A scripting language can be viewed as a domain-specific language for a particular environment; in the case of scripting an application, this is also known as an extension language. Scripting languages are also sometimes referred to as very high-level programming languages, as they operate at a high level of abstraction, or as control languages, particularly for job control languages on mainframes. Characteristics Typically scripting languages are intended to be very fast to learn and write in, either as short source code files or interactively in a read–eval–print loop (REPL, language shell). This generally implies relatively simple syntax and semantics; typically a "script" (code written in the scripting language) is executed from start to finish, as a "script", with no explicit entry point. For example, it is uncommon to characterise Java as a scripting language because of its lengthy syntax and rules about which classes exist in which files, and it is not directly possible to execute Java interactively, because source files can only contain definitions that must be invoked externally by a host application or application launcher. public class HelloWorld { public void printHelloWorld() { System.out.println("Hello World"); } } This piece of code intended to print "Hello World" does nothing as main() is not declared in HelloWorld class. In contrast, Python allows definition of some functions in a single file, or to avoid functions altogether and use imperative programming style, or even use it interactively. print ("Hello World") This one line of python code prints "Hello World"; no declarative statement like main() is required here. A scripting language is usually interpreted from source code or bytecode. By contrast, the software environment the scripts are written for is typically written in a compiled language and distributed in machine code form. Scripting languages may be designed for use by end users of a program—end-user development—or may be only for internal use by developers, so they can write portions of the program in the scripting language. Scripting languages typically use abstraction, a form of information hiding, to spare users the details of internal variable types, data storage, and memory management. Scripts are often created or modified by the person executing them, but they are also often distributed, such as when large portions of games are written in a scripting language. RoboMind scripting language RoboMind offers a basic scripting language that consists of a concise set of rules. Apart from commands to make the robot perform basic movement instructions, the control flow can be modified by conditional branching (if-then-else), loops (while) and calls to custom procedures. Example script to draw square: paintWhite repeat(4) { forward(2) right } Recursive line follower example: follow procedure follow{ if(frontIsWhite){ forward(1) } else if(rightIsWhite){ right } else if(leftIsWhite){ left } else{ end } follow } The programming environment offers an integrated text editor to write these scripts, with syntax highlighting, autocompletion and line numbering. Modifications to the environment, such as painting grid cells, are used to store a runtime state. This shows the robot in its environment is directly related to 2D Turing machines. Since version 5.0, the language does allow the declaration of variables and functions (procedures that return values). The scripting language itself is currently available in 22 languages: Arabic, Catalan, Chinese, Czech, Dutch, English, French, German, Greek, Hungarian, Indonesian, Korean, Polish, Brazilian Portuguese, Russian, Slovak, Slovenian, Spanish, Swedish, Thai, Turkish and Ukrainian. All instructions and keywords can be translated. This makes it easier to learn for non-English speakers than most other programming languages that are constrained to English syntax and Latin alphabets. Category:Programming Category:RoboMind